package com.htpro.controller;

import com.htpro.pojo.Film;
import com.htpro.pojo.listt;
import com.htpro.service.ListtService;
import com.htpro.service.PlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
public class ListtController {
    @Autowired
    private ListtService ls;
    @GetMapping("/listbyuid/{uid}")
    public List<listt> listbyuid(@PathVariable("uid") Integer uid){
        List<listt> l = ls.getlisttbyuid(uid);
        return l;
    }
    @GetMapping("/delectlistbysid/{sid}")
    public int delectlistbysid(@PathVariable("sid") Integer sid){
        int l = ls.delectbysid(sid);
        return l;
    }
    @GetMapping("/insertlist/{uid}/{sid}/{pid}")
    public int insertlist(@PathVariable("sid") Integer sid,
                          @PathVariable("pid") Integer pid,
                          @PathVariable("uid") Integer uid){
        listt listts=new listt();
        listts.setSid(sid);
        listts.setPid(pid);
        listts.setUid(uid);
        int l = ls.addlisttbyuid(listts);
        return l;
    }
}
